Skip to main content
POST

Overview

Connect a phone number from your telephony provider so it can be used in campaigns and for inbound calls. The number is added for the user who owns the API key. For Plivo, Twilio, Vobiz and Telnyx, your credentials are checked with the provider before the number is saved, and the provider is set up to send call events to Weya. Elisiontec checks the API token only. SIP trunks are saved without a connection check. Supported providers: twilio, plivo, telnyx, vobiz, elisiontec and sip.

Prerequisites

  • An API key for your workspace
  • An account with the provider, and the number in that account

Request

string
required
Your workspace API key. Create one from the profile menu in the dashboard → API Keys.
string
required
Telephony provider: twilio, plivo, telnyx, vobiz, elisiontec or sip. Not case-sensitive.
string
Phone number with country code, for example +12125551234. A missing + is added. Required for every provider except sip.
string
Provider credential. Required for every provider except sip.
  • Plivo, Twilio, Vobiz: the Auth Token
  • Telnyx: the API key
  • Elisiontec: the API token
string
Account ID. Required for Plivo (Auth ID), Twilio (Account SID) and Vobiz (Auth ID). Not used for Telnyx.
string
Elisiontec only, required: the list ID.
string
SIP only, required: SIP server host.
string
SIP only, required: SIP username. A trunk with the same host and username can’t be added twice.
string
SIP only: SIP password.
integer
default:"5060"
SIP only: SIP server port.
string
SIP only: the “from” user for outgoing calls.
string
default:"udp"
SIP only: udp, tcp or tls.
boolean
default:"true"
SIP only: whether to register with the SIP server.

Response

object
required
The saved phone number record. It also contains the credentials you sent, so don’t log the response.
string
required
Phone number ID. Use it in callingNumbers when creating a campaign.
string
The phone number, with + and country code.
string
required
Telephony provider.

Error Handling

Errors return status: false, with the reason in errorMessage.
  • 400 Bad Request
    • Unknown integration type: … – integration is missing or not supported.
    • Phone number is required, Auth token is required for telephony integrations, or Twilio, Plivo and Vobiz require accSId.
    • Elisiontec API token is required, Elisiontec List ID is required or Phone Number (DID) is required.
    • Phone number already exists for this user, or SIP trunk already exists for host … and username ….
    • Invalid credentials, for example Invalid Plivo SID or Auth Token. Please check your credentials. For Twilio and Telnyx this also means the number isn’t in that account.
  • 401 Unauthorized – Missing or invalid API key.
  • 500 Internal Server Error – The credentials were valid but setting up call events with the provider failed, or another server error. A missing sipHost or sipUsername also returns 500.
Numbers must be unique per user: the same number can’t be added twice by the same user.